package study01;

import java.util.Arrays;
import java.util.Comparator;
//实现Comparator接口
class MyComparator implements Comparator<Integer> {
    @Override
    public int compare(Integer a, Integer b) {
        return a > b ? -1 : 1;
    }
    public static void main(String[] args) {
        Integer[] arr = {9, 8, 7, 2, 3, 4, 1, 0, 6, 5};
        Comparator cmp = new MyComparator();
        Arrays.sort(arr, cmp);
        //Arrays.sort(arr,4,7);
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
        System.out.println(Arrays.toString(arr));
    }
}